import UtilWaitObj from "@/util/util-wait-obj";

let startArgs = {
    cameraIndexCode: '0420210104CCRRF35881791WCVU',
    streamMode: 0,
    transMode: 1,
    gpuMode: 0,
    wndId: -1
}

async function generateHkPlayArgument(pubKey) {
    return {
        appkey: "23991440",
        secret: await getEncrypt(pubKey),
        ip: "117.158.156.164",
        playMode: 0, // 预览
        port: 801,
        snapDir: "D:\\SnapDir",
        videoDir: "D:\\VideoDir",
        layout: "1x1",
        enableHTTPS: 0,
        encryptedFields: "secret",
        showToolbar: 1, //是否显示工具栏，0-不显示，非0-显示
        showSmart: 1, //是否显示智能信息（如配置移动侦测后画面上的线框），0-不显示，非0-显示
        buttonIDs: "0,16,256,257,258,259,260,512,513,514,515,516,517,768,769", //自定义工具条按钮
    }
}

// rtsp://23991440:G9MvIH2NnYQ4hLJ1eG6p@117.158.156.164:801/Streaming/Channels/0

async function getEncrypt(pubKey) {
    let JSEncrypt = await UtilWaitObj.waitObj('JSEncrypt')
    var encrypt = new JSEncrypt();
    encrypt.setPublicKey(pubKey)
    return encrypt.encrypt('G9MvIH2NnYQ4hLJ1eG6p');
}

export default {
    generateHkPlayArgument,
    getEncrypt,
    startArgs
}